/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Fernando
 */
@Entity
@Table(name = "laboratorio")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Laboratorio.findAll", query = "SELECT l FROM Laboratorio l"),
    @NamedQuery(name = "Laboratorio.findByIdLaboratorio", query = "SELECT l FROM Laboratorio l WHERE l.idLaboratorio = :idLaboratorio"),
    @NamedQuery(name = "Laboratorio.findByNombre", query = "SELECT l FROM Laboratorio l WHERE l.nombre = :nombre"),
    @NamedQuery(name = "Laboratorio.findByDepartamento", query = "SELECT l FROM Laboratorio l WHERE l.departamento = :departamento"),
    @NamedQuery(name = "Laboratorio.findByCoordinador", query = "SELECT l FROM Laboratorio l WHERE l.coordinador = :coordinador"),
    @NamedQuery(name = "Laboratorio.findByEdificio", query = "SELECT l FROM Laboratorio l WHERE l.edificio = :edificio"),
    @NamedQuery(name = "Laboratorio.findByExtension", query = "SELECT l FROM Laboratorio l WHERE l.extension = :extension")})
public class Laboratorio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idLaboratorio")
    private Integer idLaboratorio;
    @Column(name = "Nombre")
    private String nombre;
    @Column(name = "Departamento")
    private String departamento;
    @Column(name = "Coordinador")
    private String coordinador;
    @Column(name = "Edificio")
    private String edificio;
    @Column(name = "Extension")
    private String extension;
    @OneToMany(mappedBy = "idLaboratorio")
    private Collection<Equipo> equipoCollection;
    @OneToMany(mappedBy = "idLaboratorio")
    private Collection<Practica> practicaCollection;

    public Laboratorio() {
    }

    public Laboratorio(Integer idLaboratorio) {
        this.idLaboratorio = idLaboratorio;
    }

    public Integer getIdLaboratorio() {
        return idLaboratorio;
    }

    public void setIdLaboratorio(Integer idLaboratorio) {
        this.idLaboratorio = idLaboratorio;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDepartamento() {
        return departamento;
    }

    public void setDepartamento(String departamento) {
        this.departamento = departamento;
    }

    public String getCoordinador() {
        return coordinador;
    }

    public void setCoordinador(String coordinador) {
        this.coordinador = coordinador;
    }

    public String getEdificio() {
        return edificio;
    }

    public void setEdificio(String edificio) {
        this.edificio = edificio;
    }

    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

    @XmlTransient
    public Collection<Equipo> getEquipoCollection() {
        return equipoCollection;
    }

    public void setEquipoCollection(Collection<Equipo> equipoCollection) {
        this.equipoCollection = equipoCollection;
    }

    @XmlTransient
    public Collection<Practica> getPracticaCollection() {
        return practicaCollection;
    }

    public void setPracticaCollection(Collection<Practica> practicaCollection) {
        this.practicaCollection = practicaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLaboratorio != null ? idLaboratorio.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Laboratorio)) {
            return false;
        }
        Laboratorio other = (Laboratorio) object;
        if ((this.idLaboratorio == null && other.idLaboratorio != null) || (this.idLaboratorio != null && !this.idLaboratorio.equals(other.idLaboratorio))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Laboratorio[ idLaboratorio=" + idLaboratorio + " ]";
    }
    
}
